package cn.domypay.back.biz.impl;

import java.util.List;
import java.util.Properties;

import cn.domypay.back.base.BaseObj;
import cn.domypay.back.base.impl.BaseBizImpl;
import cn.domypay.back.bean.DmpOrderInfo;
import cn.domypay.back.biz.DmpOrderInfoBiz;
import cn.domypay.back.conf.OrderContants;
import cn.domypay.back.conf.SysContants;
import cn.domypay.back.exception.DoMyPayException;
import cn.domypay.back.utils.DateUtil;
import cn.domypay.back.utils.ReadProperties;

public class DmpOrderInfoBizImpl extends BaseBizImpl implements DmpOrderInfoBiz{

	private final static int start = 0;

	public List<BaseObj> getAllOrderByStatus(Integer status, String typeName) throws DoMyPayException {
		// TODO 自动生成方法存根
		Properties prop = ReadProperties.init(SysContants.DEFAULT_PROPERTIES_FILE);
		
		DmpOrderInfo dmpOrderInfo = new DmpOrderInfo();
		dmpOrderInfo.setOrderStatus(status);
		dmpOrderInfo.setTypeName(typeName);
		
		return this.getBaseDao().getTopList(dmpOrderInfo, "getAllOrderByStatus", start, Integer.valueOf(prop.getProperty("maxorder")));
	}
	
	/**
	 * 订单处理后的状态修改
	 * @throws DoMyPayException 
	 */
	public void modityOrderStatus(DmpOrderInfo dmpOrderInfo) throws DoMyPayException
	{
		dmpOrderInfo.setOrderStatus(OrderContants.ORDER_STATUS_SHIPPED);
		dmpOrderInfo.setShipTime(DateUtil.getIntDate());
		this.getBaseDao().modify(dmpOrderInfo, "updateOrder");
	}
}
